package org.tio.sitexxx.web.server.utils;

import java.lang.reflect.Field;
import java.util.Map;

public class ObjectToMap {
    public static void beanToMap(Map<String, Object> res, Object object) throws Exception {
        if(object==null){
            res.put("status","null");
            return;
        }
        Class cls = object.getClass();
        Field[] fields = cls.getDeclaredFields();
        for (Field field : fields) {
            field.setAccessible(true);
            if(field.get(object)!=null)
            res.put(field.getName(), field.get(object));
        }

    }
}
